package com.clock.web.controller.user;

import com.clock.common.core.controller.BaseController;
import com.clock.common.core.domain.AjaxResult;
import com.clock.shop.domain.ShopShop;
import com.clock.shop.service.IShopShopService;
import com.clock.shop.service.IUserScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/score")
public class UserScoreController extends BaseController {

    @Autowired
    private IUserScoreService userScoreService;
    @Autowired
    private IShopShopService shopShopService;

    //计算店铺平均得分
    @GetMapping("/shopScore")
    public AjaxResult getShopScore(Long shopId) {
        //返回店铺得分
        return success(userScoreService.getShopScore(shopId));
    }

    //选出平均得分最高的三家店铺进行推荐
    @GetMapping("/topShop")
    public AjaxResult getTopShop() {
        //返回得分最高的三家店铺id
        return success(userScoreService.getTopShop());
    }



}
